﻿using System;
using QFramework;
using UnityEngine;
using NotImplementedException = System.NotImplementedException;

namespace ProjectSurvival.System.Save
{
    public class SaveSystem : AbstractSystem, ICanSave
    {
        protected override void OnInit()
        {
        }

        public void Save()
        {
        }

        public void Load()
        {
        }

        public void SaveInt(string key, int value)
        {
            PlayerPrefs.SetInt(key, value);
        }

        public int LoadInt(string key, int defaultValue = 0)
        {
            return PlayerPrefs.GetInt(key, defaultValue);
        }

        public void SaveString(string key, string content)
        {
            PlayerPrefs.SetString(key, content);
        }

        public string LoadString(string key, string deftualtContent = default)
        {
            return PlayerPrefs.GetString(key, deftualtContent);
        }

        public void SaveBool(string key, bool value)
        {
            PlayerPrefs.SetInt(key, value ? 1 : 0);
        }

        public bool LoadBool(string key, bool defualtValue = false)
        {
            return PlayerPrefs.GetInt(key, defualtValue ? 1 : 0) == 1;
        }
    }
}